\doxysection{v\+Task\+Delay\+Until }
\hypertarget{group__v_task_delay_until}{}\label{group__v_task_delay_until}\index{vTaskDelayUntil@{vTaskDelayUntil}}
task. h 
\begin{DoxyPre}void vTaskDelayUntil( TickType\_t *pxPreviousWakeTime, const TickType\_t xTimeIncrement );\end{DoxyPre}


INCLUDE\+\_\+v\+Task\+Delay\+Until must be defined as 1 for this function to be available. See the configuration section for more information.

Delay a task until a specified time. This function can be used by periodic tasks to ensure a constant execution frequency.

This function differs from v\+Task\+Delay () in one important aspect\+: v\+Task\+Delay () will cause a task to block for the specified number of ticks from the time v\+Task\+Delay () is called. It is therefore difficult to use v\+Task\+Delay () by itself to generate a fixed execution frequency as the time between a task starting to execute and that task calling v\+Task\+Delay () may not be fixed \mbox{[}the task may take a different path though the code between calls, or may get interrupted or preempted a different number of times each time it executes\mbox{]}.

Whereas v\+Task\+Delay () specifies a wake time relative to the time at which the function is called, v\+Task\+Delay\+Until () specifies the absolute (exact) time at which it wishes to unblock.

The constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS can be used to calculate real time from the tick rate -\/ with the resolution of one tick period.


\begin{DoxyParams}{Parameters}
{\em px\+Previous\+Wake\+Time} & Pointer to a variable that holds the time at which the task was last unblocked. The variable must be initialised with the current time prior to its first use (see the example below). Following this the variable is automatically updated within v\+Task\+Delay\+Until ().\\
\hline
{\em x\+Time\+Increment} & The cycle time period. The task will be unblocked at time \texorpdfstring{$\ast$}{*}px\+Previous\+Wake\+Time + x\+Time\+Increment. Calling v\+Task\+Delay\+Until with the same x\+Time\+Increment parameter value will cause the task to execute with a fixed interface period.\\
\hline
\end{DoxyParams}
Example usage\+: 
\begin{DoxyPre}
// Perform an action every 10 ticks.
void vTaskFunction( void * pvParameters )
\{
TickType\_t xLastWakeTime;
const TickType\_t xFrequency = 10;

    // Initialise the xLastWakeTime variable with the current time.
    xLastWakeTime = xTaskGetTickCount ();
    for( ;; )
    \{
     // Wait for the next cycle.
     vTaskDelayUntil( \&xLastWakeTime, xFrequency );

     // Perform action here.
    \}
\}
  \end{DoxyPre}
 